import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout.vue'
import Index from '@/views/index.vue'
Vue.use(VueRouter)

const routes = [
  /* webpackChunkName: "about" */
  {
    path: '/',
    component: Layout,
    redirect: '/index',
    children: [
      {
        path: 'index',
        component: Index
      },
      {
        path: 'search',
        component: () => import('@/views/search-home.vue')
      },
      {
        path: 'news',
        component: () => import('@/views/news.vue')
      },
      {
        path: 'user',
        component: () => import('@/views/user.vue')
      }
    ]
  },
  {
    path: '/city',
    component: () => import('@/views/city-list.vue')
  },
  {
    path: '/houses/:id',
    component: () => import('@/views/houses-info.vue')
  },
  {
    path: '/map',
    component: () => import('@/views/map.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
